<?php slot('coursesNav', 'active') ?>
<div class="courses" id="wrapper">
	<?php include_partial('global/systemMessages', array('form' => $form))?>
	<div id="content">
		<div id="main">
			<form method="post" action="<?php echo url_for('courses/update') ?>" class="settings">
				<h4>
					<span>Editing a Course at Harvard for Semester: 
						<?php echo $form['semester_id']->render() ?>
					</span>
				</h4>
				<fieldset>
					<label>Course Name</label>
					<?php echo $form['name']->render(array('class' => 'input-text'))?>
					<label>Subject</label>
					<?php echo $form['subject_id']->render() ?>
					<label>Course Number (such as A-23, 0410, 14b)</label>
					<?php echo $form['section']->render(array('class' => 'input-text', 'style' => 'width: 50px;'))?>
					<label>Instructor's Name</label>
					<?php echo $form['instructor_name']->render(array('class' => 'input-text'))?>
					<label>Instructor's Email (will not be used except in cases of copyright infringement)</label>
					<?php echo $form['instructor_email']->render(array('class' => 'input-text'))?>
				</fieldset>
				<div id="change_email_alert" style="background-color:#FFFFFF; padding: 10px;">
					<div id="change_email_alert_title">
	    				<h3 class="gradient dark">FinalsClub Warning</h3>
	    			</div>
					False copyright claims can be considered perjury. Please, do not amend the copyright attribution indicated by this email address unless you have a good faith belief that the material in question is wrongly attributed. For additional copyright questions, please contact copyright (at) finalsclub.org.
				</div>
				<h4>
					<span>Optional Information</span>
				</h4>
				<fieldset>
					<label>Course Description</label>
					<?php echo $form['description']->render() ?>
				</fieldset>
				<fieldset class="controls">
					<?php echo $form->renderHiddenFields() ?>
					<input type="submit" value="Update This Course" name="submit"/>
					<?php echo link_to('Cancel', 'groups/index')?>
				</fieldset>
			</form>
		</div>
		<div id="sidebar">

        </div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
        $("#change_email_alert").dialog({
           autoOpen: false,
           open:function() {	// get rid of the close button
    			$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove();
  		   }, 
           modal:true,
           buttons : {	// two buttons, cancel moves the focus off the field
           	"Change this email signature" : function() {
           		var ele = document.getElementById('course_instructor_email');
           		ele.focus();             
                $(this).dialog("close");
             },
             "Cancel" : function() {
             	var ele = document.getElementById('course_description');
             	ele.focus();
                $(this).dialog("close");
              }   
           }
		});
		
		$('#course_instructor_email').click(function(){
			$("#change_email_alert").dialog("open");
		});
	});
</script>
